package com.fengwan.wastesort.ui.viewModel

import android.app.Application
import androidx.core.database.getIntOrNull
import androidx.core.database.getStringOrNull
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel;
import com.fengwan.wastesort.model.Waste
import com.fengwan.wastesort.ui.viewModel.WasteDbViewModel
import org.jetbrains.anko.db.*

class WasteDryViewModel(app: Application) : WasteDbViewModel(app) {

    val dryWastes = MutableLiveData<List<Waste>>()

    fun loadDryWastes(_id: Int = 0, type: Int = 0) {
        dryWastes.value = database.select(tabName, "_id", "name","type")
                .whereArgs("(_id > $_id) and (type = $type)")
                .limit(50)
                .parseList(classParser<Waste>())
    }

}
